/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.cspimp.pod.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import me.zhengjie.base.BaseCspImpEntity;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://docs.auauz.net
* @description /
* @author zmm
* @date 2020-06-26
**/
@Entity
@Data
@Table(name="pod_car")
public class Car extends BaseCspImpEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(value = "id")
    private Long id;

    @Column(name = "name",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "车辆名称")
    private String name;

    @Column(name = "car_type_id")
    @ApiModelProperty(value = "车辆类型主键")
    private Long carTypeId;

    @Column(name = "car_type_code")
    @ApiModelProperty(value = "车辆类型code")
    private String carTypeCode;

    @Column(name = "car_type_name")
    @ApiModelProperty(value = "车辆类型名称")
    private String carTypeName;

    @Column(name = "car_number")
    @ApiModelProperty(value = "车牌号")
    private String carNumber;

    @Column(name = "driver")
    @ApiModelProperty(value = "驾驶员")
    private Long driver;

    @Column(name = "supercargo")
    @ApiModelProperty(value = "押运员")
    private Long supercargo;

    @Column(name = "waybill")
    @ApiModelProperty(value = "运单信息")
    private String waybill;

    @Column(name = "tag")
    @ApiModelProperty(value = "标签")
    private String tag;

    @Column(name = "icon")
    @ApiModelProperty(value = "图标")
    private String icon;

    public void copy(Car source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}